package com.bing.common.util.context;

/**
 * @Description UserContextHolder
 * @Author Bing
 * @Date 2024/10/14 17:51
 */
public class UserContextHolder {

    private static final ThreadLocal<Long> USERCONTEXTHOLDER = new ThreadLocal<>();

    public static Long getUserId() {
        return USERCONTEXTHOLDER.get();
    }

    public static void setUserId(Long userId) {
        USERCONTEXTHOLDER.set(userId);
    }

    public static void remove() {
        USERCONTEXTHOLDER.remove();
    }
}